<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
	$(function() {
		$('#addrbook_classAddrbookList_datagrid').datagrid({
			url : '${pageContext.request.contextPath}/classAddrbookAction!queryAddrbook.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10, 20 ],
			sortName : 'name',
			sortOrder : 'asc',
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 80,
				checkbox : true
			}, {
				field : 'name',
				title : '姓名',
				width : 80,
				align : 'left',
				sortable : true
			}, {
				field : 'gender',
				title : '性别',
				width : 60,
				hidden : true
			}, {
				field : 'genderName',
				title : '性别',
				width : 60,
				align : 'center'
			}, {
				field : 'position',
				title : '职位',
				width : 100,
				align : 'left'
			}, {
				field : 'corporationName',
				title : '工作单位',
				width : 150,
				align : 'left'
			}, {
				field : 'mobile',
				title : '手机',
				width : 80,
				align : 'left'
			}, {
				field : 'qq',
				title : 'QQ',
				width : 80,
				align : 'left'
			}, {
				field : 'email',
				title : '电子邮件',
				width : 100,
				align : 'left'
			}, {
				field : 'phone',
				title : '固话',
				width : 80,
				align : 'left'
			}, {
				field : 'fax',
				title : '传真',
				width : 80,
				align : 'left'
			} ] ],
			toolbar : [ {
				text : '查询',
				iconCls : 'icon-search',
				handler : function() {
					queryAddrbook();
				}
			}, '-', {
				text : '同步',
				iconCls : 'icon-sync',
				handler : function() {
					syncAddrbook();
				}
			} ]
		});

		$('.datagrid-header div').css({
			'textAlign' : 'center'
		});

		function queryAddrbook() {
			$('#addrbook_classAddrbookList_queryForm input').val('');
			$('#addrbook_classAddrbookList_queryDialog').dialog('open');
		}

		function syncAddrbook() {
			$.messager.confirm('确认', '确定要进行数据同步吗？', function(r) {
				if (r) {
					$.ajax({
						url : '${pageContext.request.contextPath}/classAddrbookAction!syncAddrbook.action',
						dataType : 'json',
						success : function(r) {
							$.messager.show({
								title : '提示',
								msg : r.msg,
							});
						}
					});
				}
			});
		}
		
		

	});
</script>
<div id="addrbook_classAddrbookList_layout" class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false">
		<table id="addrbook_classAddrbookList_datagrid"></table>
	</div>
</div>
<div id="addrbook_classAddrbookList_queryDialog" class="easyui-dialog" data-options="title:'联系人查询',closed:true,modal:true,
			buttons:[{
				text : '查询',
				handler : function(){
					$('#addrbook_classAddrbookList_datagrid').datagrid('load', serializeObject($('#addrbook_classAddrbookList_queryForm')));
				    $('#addrbook_classAddrbookList_queryDialog').dialog('close');
				}
			},{
				text : '清空',
				handler : function(){
					$('#addrbook_classAddrbookList_queryForm input').val('');
				}
			}]" style="width:380px;height:230px;padding:20px 10px;" align="center">
	<form id="addrbook_classAddrbookList_queryForm" method="post">
		<table>
			<tr>
				<td style="text-align: right;">姓名：</td>
				<td><input name="name" style="width:240px;" /></td>
			</tr>
			<tr>
				<td style="text-align: right;">手机：</td>
				<td><input name="mobile" style="width:240px;" /></td>
			</tr>
			<tr>
				<td style="text-align: right;">QQ：</td>
				<td><input name="qq" style="width:240px;" /></td>
			</tr>
			<tr>
				<td style="text-align: right;">电子邮件：</td>
				<td><input name="email" style="width:240px;" /></td>
			</tr>
		</table>
	</form>
</div>